package com.aurora.controller;


import com.aurora.model.vo.Result;
import com.aurora.service.MessageInfoService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liu jun
 */
@RestController()
@RequestMapping("/message")
@Api(tags = "MQTT消息接口")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class MessageController {

    private final MessageInfoService messageService;


    @GetMapping("/getUserList")
    public Result<?> getUserList() {

        return Result.ok();
    }

    /**
     * 得到聊天记录
     * @param receiverId 接收者id
     * @param pageSize 页大小
     * @param pageNum 页码
     * @method GET
     * @return Result
     */
    @GetMapping("/getChatRecord")
    public Result<?> getChatRecord(@RequestParam String receiverId,
                                   @RequestParam(required = false, defaultValue = "10") Integer pageSize,
                                   @RequestParam(required = false, defaultValue = "1") Integer pageNum) {
        return Result.ok(messageService.getChatRecord(receiverId,pageSize,pageNum));
    }
}
